package fei.zhou.springboot3.business.interceptor;

/**
 * 描述该类- JPA
 *
 * @author zhoufei
 * @class: LoginHandlerInterceptor
 * @date 2021/1/13  16:42
 * @Verson 1.0 -2021/1/13  16:42
 * @see
 */

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 登陆检查，
 */
public class LoginHandlerInterceptor implements HandlerInterceptor {
    //目标方法执行之前
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

        String requestURL = request.getRequestURL().toString();
        System.out.println("requestURL："+requestURL);
        //false时，拦截器执行到此处将不会继续操作
        //true时，继续执行后面的操作
        return true;
    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {

    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {

    }
}